<html>
<head>
	<meta charset="UTF-8">
	<meta content="IE=edge" http-equiv="X-UA-Compatible">
	<meta content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width" name="viewport">
	<title>2349：[Baltic2011]Polygon</title>
	<!-- css -->
	<link href="../css/base.min.css" rel="stylesheet">
	<link href="../css/project.min.css" rel="stylesheet">
	
	<!-- favicon -->
	<!-- ... -->
</head>
<body class="page-brand">
	<header class="header header-transparent header-waterfall ui-header">
		<ul class="nav nav-list pull-left">
			<li>
				<a data-toggle="menu" href="#menu">
					<span class="icon icon-lg">menu</span>
				</a>
			</li>
		</ul>
		<a class="header-logo header-affix-hide margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">[Baltic2011]Polygon</a>
		<span class="header-logo header-affix margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">[Baltic2011]Polygon</span>
	</header>
	<nav aria-hidden="true" class="menu" id="menu" tabindex="-1">
		<div class="menu-scroll">
			<div class="menu-content">
				<a class="menu-logo" href="../index.html">BZOJ离线题库</a>
				<ul class="nav">
					<li>
						<a class="waves-attach" data-toggle="collapse" href="#problems">题目</a>
						<ul class="menu-collapse collapse in" id="problems">
							<li>
								<a class="waves-attach" href="../index.html">主页</a>
							</li>
							<li>
								<a class="waves-attach" href="../list.html">题目列表</a>
							</li>
						</ul>
					</li>
					<li>
						<a class="collapsed waves-attach" data-toggle="collapse" href="#about">关于</a>
						<ul class="menu-collapse collapse" id="about">
							<li>
								<a class="waves-attach" href="../about.html">关于此项目</a>
							</li>
						</ul>
					</li>
					
				</ul>
			</div>
		</div>
	</nav>
	<main class="content">
		<div class="content-header ui-content-header">
			<div class="container">
				<h1 class="content-heading">
                [Baltic2011]Polygon                </h1>
                <p>时间限制：10s&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  空间限制：256MB</p>			</div>
		</div>
		<div class="container">
			<section class="content-inner margin-top-no">
				<div class="row">
					<div class="col-lg-13 col-md-13">
						<div class="card margin-bottom-no">
							<div class="card-main">
								<div class="card-inner">
									
                                <h3>题目描述</h3><p><p class="MsoNormal" align="center" style="margin: 0cm 0cm 0pt; text-align: center"><span style="font-size: 16pt; font-family: 黑体; mso-hansi-font-family: 黑体"><span lang="EN-US"><o:p></o:p></span></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 24pt; mso-char-indent-count: 2.0; mso-char-indent-size: 12.0pt"><span style="font-size: 12pt; font-family: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">一个有</span><i style="mso-bidi-font-style: normal"><span lang="EN-US" style="font-size: 12pt"><font face="Times New Roman">N</font></span></i><span style="font-size: 12pt; font-family: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">个顶点的简单多边形，画在一个无限大的矩形网格中。对于这样的多边形，只有相邻的两边在它们共同的顶点处相交；没有其它边相交或有接触。该多边形的顶点都在网格的网点上，也就是说，多边形的顶点都是整数坐标。</span><span lang="EN-US" style="font-size: 12pt"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin: 0cm 0cm 0pt; text-indent: 24pt; mso-char-indent-count: 2.0; mso-char-indent-size: 12.0pt"><span style="font-size: 12pt; font-family: 宋体; mso-hansi-font-family: 'Times New Roman'; mso-ascii-font-family: 'Times New Roman'">你的任务是得到严格地处于给定的多边形中的网格线的总长度（这些网格的线段片段在下面的图中着重描出了）。</span><span lang="EN-US" style="font-size: 12pt"><o:p></o:p></span></p>
<p></p></p><hr/><h3>输入格式</h3><p><div>&nbsp;</div>
<div style="text-indent: 24pt"><span style="font-size: 12pt">第一行包括一个整数</span><i><span style="font-size: 12pt">N</span></i><span style="font-size: 12pt">，即多边形的顶点数。</span></div>
<div style="text-indent: 24pt"><span style="font-size: 12pt">以下</span><i><span style="font-size: 12pt">N</span></i><span style="font-size: 12pt">行包括</span><span style="font-size: 12pt">2</span><span style="font-size: 12pt">个整数</span><i><span style="font-size: 12pt">x</span></i><span style="font-size: 12pt">和</span><i><span style="font-size: 12pt">y</span></i><span style="font-size: 12pt">，即顶点的坐标。顶点将按顺时针或逆时针顺序给出。所有顶点均不相同，但可能有连续</span><span style="font-size: 12pt">2</span><span style="font-size: 12pt">个以上的顶点是在同一条直线上的。</span></div></p><hr/><h3>输出格式</h3><p><div>&nbsp;</div>
<div style="text-indent: 24pt"><span style="font-size: 12pt">输出只有一行，给出一个带小数部分的数（</span><span style="font-size: 12pt">decimal number</span><span style="font-size: 12pt">）：严格地处于给定的多边形中的网格线的总长度。</span></div>
<div><b><span style="font-size: 14pt">数据范围</span></b></div>
<div style="text-indent: 24pt"><span style="font-size: 12pt">3&le; <i>N</i> &le;100 000</span></div>
<div style="text-indent: 24pt"><span style="font-size: 12pt">-500 000 000&le; <i>x</i>, <i>y</i> &le;500 000 000</span></div>
<div style="text-indent: 24pt"><span style="font-size: 12pt">有</span><span style="font-size: 12pt">50</span><span style="font-size: 12pt">分的数据点中，所有多边形的边都处于网格线上。</span></div>
<div><b><span style="font-size: 14pt">评分</span></b></div>
<div style="text-indent: 24pt"><span style="font-size: 12pt">若你的输出与标准答案足够接近即可判正确。</span></div>
<div style="text-indent: 24pt"><i><span style="font-size: 12pt">更准确地说：假设你的输出为</span></i><i><span style="font-size: 12pt">L</span></i><i><span style="font-size: 12pt">，标准答案为</span></i><i><span style="font-size: 12pt">R</span></i><i><span style="font-size: 12pt">。那至少以下两个条件至少要有一条成立</span></i><i><span style="font-size: 12pt">:</span></i></div>
<div style="margin: 0cm 0cm 0pt 45.1pt; text-indent: -21pt"><span style="font-size: 12pt">l<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 12pt">|<i>L </i>- <i>R</i>|&le;R∙10<sup>-6</sup></span><span style="font-size: 12pt">（相对精确）</span></div>
<div style="margin: 0cm 0cm 0pt 45.1pt; text-indent: -21pt"><span style="font-size: 12pt">l<span style="font: 7pt 'Times New Roman'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><span style="font-size: 12pt">|<i>L </i>- <i>R</i>|&le;10<sup>-6</sup></span><span style="font-size: 12pt">（绝对精确）</span></div>
<div><b><span style="font-size: 14pt">&nbsp;</span></b></div></p><hr/><h3>样例输入</h3><pre>3
5 1
2 4
1 1</pre><hr/><h3>样例输出</h3><pre>10.0</pre><hr/><h3>提示</h3><p><div style="text-indent: 24pt"></div>
<div style="text-indent: 24pt"><span style="font-size: 12pt"><img height="251" width="291" alt="" src="../file/2349_0.jpg" /></span></div>
<div style="text-indent: 24pt"><span style="font-size: 12pt">水平的线段总长度为</span><span style="font-size: 12pt">4/3+8/3=4</span><span style="font-size: 12pt">，垂直的线段总长度为</span><span style="font-size: 12pt">3+2+1=6</span><span style="font-size: 12pt">。总长度为</span><span style="font-size: 12pt">4+6=10</span><span style="font-size: 12pt">。</span></div></p><hr/><h3>题目来源</h3><p>没有写明来源</p>
								</div>
							</div>
						</div>
					</div>
				</div>
				
				
			</section>
		</div>
	</main>

	<div class="fbtn-container">
		<div class="fbtn-inner">
			<a class="fbtn fbtn-lg fbtn-brand-accent waves-attach waves-circle waves-light waves-effect" data-toggle="dropdown" aria-expanded="true"><span class="fbtn-text fbtn-text-left">Menu</span><span class="fbtn-ori icon">apps</span><span class="fbtn-sub icon">close</span></a>
			<div class="fbtn-dropup">
				<a class="fbtn fbtn-brand waves-attach waves-circle waves-light waves-effect" href="../list.html" target="_self"><span class="fbtn-text fbtn-text-left">题目列表</span><span class="icon">menu</span></a>
				<a class="fbtn fbtn-green waves-attach waves-circle waves-effect" href="../index.html" target="_self"><span class="fbtn-text fbtn-text-left">返回主页</span><span class="icon">home</span></a>
				<a class="fbtn waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/submitpage.php?id=2349" target="_blank"><span class="fbtn-text fbtn-text-left">提交代码</span><span class="icon">send</span></a>
				<a class="fbtn fbtn-orange waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/wttl/wttl.php?pid=2349" target="_blank"><span class="fbtn-text fbtn-text-left">试题讨论</span><span class="icon">chat</span></a>
				
			</div>
		</div>
	</div>

	<!-- js -->
	<script src="../js/jquery.min.js"></script>
	<script src="../js/base.min.js"></script>
	<script src="../js/project.min.js"></script>
</body>
</html>